package com.lp.compt.repositories;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.lp.compt.pojo.SsResultsEntity;

import java.util.List;

/**
 * 服务类
 *
 * @author
 * @since 1.0.0
 */
@Repository
public interface SsResultsEntityRepository extends JpaRepository<SsResultsEntity, Integer>, JpaSpecificationExecutor<SsResultsEntity> {

    @Query(value = "SELECT COUNT(*) FROM ss_results WHERE id_compettion = ?1 ORDER BY id_compettion", nativeQuery = true)
    int findByCount(Integer idCompettion);

    @Query(value = "select * from ss_results r left join sys_user u on(r.id_user = u.id) where r.id_compettion = ?1 ", nativeQuery = true)
    List<Object> queryUser(String id);


}